using DG.Tweening;
using UnityEngine;
namespace CGF
{
    public partial class PopupSucWithdraw : UIComponentBase, IAwake<UILayer, bool>, IDestroy
    {
        public static void Open()
        {
            UIManagerComponent.instance.OpenUI<PopupSucWithdraw>(UILayer.Normal, RootComponent.instance, true);
        }

        public static void Close()
        {
            UIManagerComponent.instance.CloseUI<PopupSucWithdraw>();
        }

        public async void Awake(UILayer layer, bool isFloat)
        {
            await SpawnPrefab("Prefabs/GameUI/PopupSucWithdraw", layer, isFloat);
			BindProperties(transform);
            
            BtnClose.SetClick(Close);

            Bg.fillAmount = 0;
            Dialog.transform.localScale = Vector3.zero;

            DOVirtual.Float(0, 1, 0.2f, v =>
            {
                Bg.fillAmount = v;
            }).OnComplete(() =>
            {
                Dialog.transform.DOScale(Vector3.one, 0.35f).SetEase(Ease.OutBack);
            });
        }

        public override void OnDestroy()
        {
            base.OnDestroy();
        }

    }
}
